package com.fadadianqi.logistics.admin.net.handler;

import com.fadadianqi.logistics.admin.net.ChannelHandler;
import com.fadadianqi.logistics.admin.net.PacketDeliverer;
import com.fadadianqi.logistics.admin.net.Session;
import com.fadadianqi.logistics.admin.net.mina.NIOPacketDeliverer;
import com.fadadianqi.logistics.admin.net.packet.KeepAliveActPacket;
import com.fadadianqi.logistics.admin.net.packet.KeepAlivePacket;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class KeepAliveHandler implements ChannelHandler<KeepAlivePacket> {

    private static final Log log = LogFactory.getLog(KeepAliveHandler.class);

    @Override
    public void process(KeepAlivePacket packet) throws Exception {
        log.debug("#process# action:" + packet.getHead().getAction());
        Session session = packet.getSession();
        KeepAliveActPacket ack = new KeepAliveActPacket();
        ack.setSession(session);
        PacketDeliverer deliver = new NIOPacketDeliverer();
        deliver.deliver(ack);
        /*HashMap<String, String> map = new HashMap<String, String>();
		map.put("customerId", "123456");
		map.put("mobile", "13116172528");
		map.put("jobId", "1233454354334543");
		map.put("text", "满山遍野的牛羊 歌声多嘹亮");
		SMSPacket sms = new SMSPacket(JSONProvider.toJSON(map));
		sms.setSession(session);
		deliver.deliver(sms);*/
    }

}
